home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / gnt / gntfilesel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-04  |  3.2 KB  |  106 lines

  1. #ifndef GNT_FILE_SEL_H
  2. #define GNT_FILE_SEL_H
  3.  
  4. #include "gntwindow.h"
  5. #include "gnt.h"
  6. #include "gntcolors.h"
  7. #include "gntkeys.h"
  8.  
  9. #define GNT_TYPE_FILE_SEL                (gnt_file_sel_get_gtype())
  10. #define GNT_FILE_SEL(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_FILE_SEL, GntFileSel))
  11. #define GNT_FILE_SEL_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_FILE_SEL, GntFileSelClass))
  12. #define GNT_IS_FILE_SEL(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_FILE_SEL))
  13. #define GNT_IS_FILE_SEL_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_FILE_SEL))
  14. #define GNT_FILE_SEL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_FILE_SEL, GntFileSelClass))
  15.  
  16. #define GNT_FILE_SEL_FLAGS(obj)                (GNT_FILE_SEL(obj)->priv.flags)
  17. #define GNT_FILE_SEL_SET_FLAGS(obj, flags)        (GNT_FILE_SEL_FLAGS(obj) |= flags)
  18. #define GNT_FILE_SEL_UNSET_FLAGS(obj, flags)    (GNT_FILE_SEL_FLAGS(obj) &= ~(flags))
  19.  
  20. typedef struct _GntFileSel            GntFileSel;
  21. typedef struct _GntFileSelPriv        GntFileSelPriv;
  22. typedef struct _GntFileSelClass        GntFileSelClass;
  23. typedef struct _GntFile             GntFile;
  24.  
  25. struct _GntFileSel
  26. {
  27.     GntWindow parent;
  28.  
  29.     GntWidget *dirs;     /* list of files */
  30.     GntWidget *files;    /* list of directories */
  31.     GntWidget *location; /* location entry */
  32.  
  33.     GntWidget *select;   /* select button */
  34.     GntWidget *cancel;   /* cancel button */
  35.  
  36.     char *current; /* Full path of the current location */
  37.     char *suggest; /* Suggested filename */
  38.     /* XXX: someone should make these useful */
  39.     gboolean must_exist; /* Make sure the selected file (the name entered in 'location') exists */
  40.     gboolean dirsonly;   /* Show only directories */
  41.     gboolean multiselect;
  42.     GList *tags;         /* List of tagged files when multiselect is set */
  43.  
  44.     gboolean (*read_fn)(const char *path, GList **files, GError **error);
  45. };
  46.  
  47. struct _GntFileSelClass
  48. {
  49.     GntWindowClass parent;
  50.  
  51.     void (*file_selected)(GntFileSel *sel, const char *path, const char *filename);
  52.     void (*gnt_reserved1)(void);
  53.     void (*gnt_reserved2)(void);
  54.     void (*gnt_reserved3)(void);
  55.     void (*gnt_reserved4)(void);
  56. };
  57.  
  58. typedef enum _GntFileType
  59. {
  60.     GNT_FILE_REGULAR,
  61.     GNT_FILE_DIR
  62. } GntFileType;
  63.  
  64. struct _GntFile
  65. {
  66.     char *fullpath;
  67.     char *basename;
  68.     GntFileType type;
  69.     unsigned long size;
  70. };
  71.  
  72. G_BEGIN_DECLS
  73.  
  74. GType gnt_file_sel_get_gtype(void);
  75.  
  76. GntWidget *gnt_file_sel_new(void);
  77.  
  78. gboolean gnt_file_sel_set_current_location(GntFileSel *sel, const char *path);
  79.  
  80. void gnt_file_sel_set_dirs_only(GntFileSel *sel, gboolean dirs);
  81.  
  82. gboolean gnt_file_sel_get_dirs_only(GntFileSel *sel);
  83.  
  84. void gnt_file_sel_set_must_exist(GntFileSel *sel, gboolean must);
  85.  
  86. gboolean gnt_file_sel_get_must_exist(GntFileSel *sel);
  87.  
  88. char *gnt_file_sel_get_selected_file(GntFileSel *sel);  /* The returned value should be free'd */
  89.  
  90. GList *gnt_file_sel_get_selected_multi_files(GntFileSel *sel);
  91.  
  92. void gnt_file_sel_set_multi_select(GntFileSel *sel, gboolean set);
  93.  
  94. void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest);
  95.  
  96. void gnt_file_sel_set_read_fn(GntFileSel *sel, gboolean (*read_fn)(const char *path, GList **files, GError **error));
  97.  
  98. GntFile* gnt_file_new(const char *name, unsigned long size);
  99.  
  100. GntFile* gnt_file_new_dir(const char *name);
  101.  
  102. G_END_DECLS
  103.  
  104. #endif /* GNT_FILE_SEL_H */
  105.  
  106.